<template>
	<view class="">
		<!-- 交易确认弹窗-->
		<u-toast ref="useToast"></u-toast>
		<u-popup :show="moneyShow" mode="center" @close="close" round="16rpx" bgColor='transparent'
			overlayOpacity='0.85' closeOnClickOverlay>
			<view class="popup-one-box flex-col align-center">
				<view class="popup-title">
					确认发货
				</view>
				<view class="has-shuijing justify-start">
					为确保你的利益，请仔细确认本次发货信息
					<!-- <text class="shui-ji-num">0</text> 个 -->
				</view>
				<u-toast ref="uToast"></u-toast>
				<view class="info-box">
					<view class="top-box">
						<view class="label">
							接收人ID
						</view>
						<view class="top-cell justify-between align-center">
							<u-input color='#FFF' border="none" clearable v-model="to_code" type='number'
							maxlength='7'
								placeholder="输入接收人ID"></u-input>
						</view>
					</view>
					<view class="top-box">
						<view class="label">
							发货数量
						</view>
						<view class="top-cell justify-between align-center">
							<u-input color='#FFF' border="none" clearable v-model="number"
							:formatter='filterNumber'
							type='number' 
								placeholder="输入发货数量"></u-input>
						</view>
					</view>
				</view>

				<view class="popup-box-btn align-center justify-center"
				 :style="{background: !disable?'#282A37':'#27ff92',color:!disable? '#8f97b0':'#000'}"
				 @click="putLong">
					确定发货
				</view>
				<view class="tips align-center justify-center">
					发货后无法撤回，请谨慎操作
				</view>
			</view>
		</u-popup>
		<!-- <modal-password :isShow='parsswordShow' @close="parsswordShow=false"
			@update='putLong1'></modal-password> -->
	</view>

</template>

<script>
	// import modalPassword from './modal-password.vue'
	export default {
		components: {
			// 注册组件
			// modalPassword
		},
		props: {
			isShow: {
				type: Boolean,
				default: false,
			},
			data: {
				type: Object,
				default: () => {},
			},

		},
		data() {
			return {
				number: 1,
				moneyShow: false,
				to_code: ''
			}
		},
		watch: {
			isShow(val) {
				console.log(val, 'modal');
				this.moneyShow = val
				if (val) {}
			}
		},
		computed:{
			disable(){
				return this.to_code.length == 7
			}
		},
		methods: {
			close() {
				this.$emit('close')
			},
			filterNumber(e){
				console.log(e);
				this.number = parseInt(e)
				return parseInt(e)
			},
			async putLong() {
				console.log('参数',this.to_code,this.number,this.data.goods_id);
				let _this = this
				let url = '/api/v1/manager_transfer'
				let {
					code,
					msg,
					data
				} = await this.$postRequest(url, {
					to_code: this.to_code,
					number: this.number,
					goods_id: this.data.goods_id
				})
				if (code == 200) {
					console.log(data, '静态资源');
					this.number = 1
					this.to_code = ''
					_this.$refs.uToast.show({
						message: msg,
						type: 'default',
						duration: '500',
						complete(){
							_this.$emit('update')
							_this.close()
						}
					
					})
					

				}
			}
		}
	}
</script>

<style>
	@import '/common/css/common.css';
</style>
<style lang="scss" scoped>
	// 放置青龙样式
	.popup-one-box {
		position: relative;
		z-index: 7;
		width: 560rpx;
		border-radius: 16rpx;
		background: #21212D;
		padding: 40rpx 40rpx 40rpx;

		.popup-title {
			font-size: 32rpx;
			font-weight: bold;
			color: #FFF;
			margin-bottom: 37rpx;
		}

		.info-box {
			width: 475rpx;
			position: relative;
			margin: 0rpx auto 41rpx;
			border-radius: 16rpx;

			.top-box {
				width: 100%;
				position: relative;
				margin: 34rpx auto 0rpx;
				background-color: #20202c;

				.label {
					font-size: 24rpx;
					color: #CFCFD9;
					margin-bottom: 11rpx;
					text-indent: 1em;
				}

				.top-cell {
					border-radius: 8rpx;
					width: 475rpx;
					background: #282A37;
					min-height: 93rpx;
					padding: 20rpx 25rpx;
					color: #FFF;

					.name {
						margin-right: 30rpx;
						font-size: 28rpx;
						color: rgba(255, 255, 255, .8);

					}

					.ava {
						width: 96rpx;
						height: 96rpx;
						border-radius: 8rpx;
					}
				}


				.my-qing-long {
					font-size: 28rpx;
					width: 260rpx;
					color: rgba(255, 255, 255, .8);
					text-align: left;
				}

				.long-num {
					width: 30rpx;
					height: 30rpx;

				}
			}

		}

		.has-shuijing {
			width: 100%;
			// height: 44rpx;
			font-size: 23rpx;
			color: #A6A6B2;
			text-indent: 1em;
		}

		.shui-ji-num {
			font-size: 28rpx;
			color: #FFF;
			font-weight: 700;
			text-align: left;
			margin-bottom: 16rpx;
		}

		.popup-box-btn {
			width: 475rpx;
			height: 90rpx;
			background: #0BFF8D;
			color: #000E00;
			font-size: 30rpx;
			border-radius: 8rpx;
			font-weight: bold;
		}

		.tips {
			margin-top: 29rpx;
			font-size: 24rpx;
			color: #CFCFD9;
		}



		.close-popup {
			width: 48rpx;
			height: 48rpx;
		}

		.popup-kuangshi {
			width: 56rpx;
			height: 36rpx;
		}






		.put-num-tip {
			font-size: 25rpx;
			font-family: SourceHanSansSC, SourceHanSansSC;
			font-weight: 400;
			color: #FFFFFF;
		}
	}

	.minus {
		width: 22px;
		height: 22px;
		@include flex;
		justify-content: center;
		align-items: center;
	}

	.input {
		padding: 0 10px;
	}

	.plus {
		width: 22px;
		height: 22px;
		// background-color: #FF0000;
		border-radius: 50%;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		justify-content: center;
		align-items: center;
	}
</style>